<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"
    import="util.Translator"%>
    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  
<% //Language management
	Translator t = new Translator();
	String lang = request.getParameter("lang");
	Cookie c = null;

	Cookie [] cookies = request.getCookies();
	if (cookies != null)
		for (Cookie i : cookies)
			if (i.getName().equals("vlang")) {
				c = i;
				break;
			}
	
	if (c == null)
		c = new Cookie("vlang", "en");
			
   if (lang != null) {
	   t.setLanguage(lang);
	   c.setValue(lang);
	}
	else
		t.setLanguage(c.getValue());
 
   response.addCookie(c);
%>

<html>
   <head>
      <link rel="stylesheet" type="text/css" href="css/indexStyle.css">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title>Vencom.prop</title>
   </head>
  
   <body>
   	<table class="langBox">
   		<tr>
   			<td><a href="index.jsp?lang=es"> <img width="55%" src="img/es.jpeg"> </a></td>
   			<td><a href="index.jsp?lang=en"> <img width="55%" src="img/en.jpeg"> </a></td>
   		</tr>
   	</table>
   	
      <table class="loginTable">
         <!-- Image Spot -->
         <tr>
            <td> 
               <center> <img width="250px" height="125px" src="img/logo.jpg"/> </center>
	         </td>
	      </tr>
	         
         <tr>
            <!-- Login form -->
	         <td class="loginBox">
               <form action="Vencom" method="post">
                  <table>
                     <tr>
                        <td class="label"> <%=t.translate("Usuario")%> </td>
	                     <td> <input type="text" name="user"/> </td>
	                  </tr>
	                  <tr>
	                     <td class="label"> <%=t.translate("Contrase&ntilde;a")%> </td>
	                     <td> <input type="password" name="password"/> </td>
	                  </tr>
	                  
	                  <%if ((request.getParameter("error") != null) &&
	                		   (request.getParameter("error").equals("login_error"))) { %>
	                  <tr>	
	                  	<th class="errorBox" colspan="2">
	 								<%=t.translate("Identificaci&oacute;n inv&aacute;lida")%>                	
	                  	</th>
	                 	</tr>
	                  <%} %>
	                  <tr>
	                  	<th colspan="2">
		                    <table>
		                        <tr> 
		                           <td> <input type="submit" value=<%=t.translate("Entrar")%>> </td>
		                           <td> 
		                           	<input type="button" value=<%=t.translate("Registrarse")%>
		                           		   onclick="window.location='register.jsp'"/> 
		                           </td>
		                           <td> <input type="button" value=<%=t.translate("Invitado")%>
		                                   onclick="window.location='search.jsp'" /> 
		                           </td> 
		                        </tr>
		                     </table>
		               	</th> 
                     </tr>
                  </table>
               </form>
            </td>
         </tr> 
      </table>

      
      <table class="infoTable" width="25%">
         <tr>
            <th colspan="5">
               <hr color="black" width=100%/>
            </th>
         </tr>
         
         <tr>
            <td class="infoBox"> <a href=""> <%=t.translate("Contacta")%> </a> </td>
            <td class="infoBox"> <a href=""> <%=t.translate("Anuncia")%> </a> </td>
            <td class="infoBox"> <a href=""> <%=t.translate("Acerca de")%> </a> </td>
            <td class="infoBox"> <a href=""> Copyright </a> </td>
         </tr>
      </table>
      
   </body>
</html>